<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>定位</title>
    <style>
      body {
        margin: 20px;
        background-color: #ccc;
      }
      .box1 {
        padding: 20px;
        background-color: bisque;
        width: 300px;
        height: 300px;
        position: relative;
      }

      .box2 {
        padding: 20px;
        background-color: rgb(51, 180, 197);
        width: 200px;
        height: 200px;
        position: relative;
      }

      .main {
        width: 50px;
        height: 50px;
        background-color: black;
        position: absolute;
        top: 0;
      }
    </style>
  </head>
  <body>
    <div class="box1">
      <div class="box2">
        <div class="main"></div>
      </div>
    </div>
  </body>
</html>
